﻿using System;
using System.Web.UI;
using Business;

namespace ServicesDirectory.UserControl
{
    public partial class DetailDirectorate : System.Web.UI.UserControl
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            cmdBack.Click += CmdBack_Click;
            cmdBack.Attributes.Add("onClick", "javascript:history.back(); return false;");
            if(Request.QueryString["inactive"]!=null)
            {
                var departmentId = new Guid(Request.QueryString["inactive"]);
                var result = DepartmentBusiness.Instance.ChangeStatus(departmentId, false);
                if (result)
                {
                    Response.Redirect("DetailDirectorate.aspx");
                }
            }
        }

        /// <summary>
        /// Handles the Click event of the CmdBack control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void CmdBack_Click(object sender, EventArgs e)
        {
            
        }
    }
}